<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>首页</title>
		<link rel="stylesheet" type="text/css" href="../css/api.css" />
		<link rel="stylesheet" type="text/css" href="../css/common.css" />
		<link rel="stylesheet" href="../css/idangerous.swiper.css">
		<script type="text/javascript" src="../js/jquery-1.8.2.min.js"></script>
		<script type="text/javascript" src="../js/echarts.min.js"></script>
		<script type="text/javascript" src="../script/api.js"></script>
	</head>
	<body>
		<div class="HeaderPosition">
			<div class="Header_left">
				<span class="Header_text"><img src="../images/money.png" class="moneyicon"/>云&nbsp币：999.89</span>
			</div>
			<div class="Header_right">
				<span class="Header_text"><img src="../images/money1.png" class="rightmoneyicon" style:"left:7px;"/>消费金：888.98</span>
			</div>
		</div>
		<div id="maina" style="width: 100%;height:400px;"></div>
		<!-- 4 评论 -->
		<div style="height: 1px; background-color: #000000;"></div>
		<div class="h20"></div>
		<div class="contentbutton">
			<span class="leftbutton" onclick="getconfirmdata()">买&nbsp入</span>
			<!-- <input type="button" text="弹出层" > -->
			<span class="rightbutton">卖&nbsp出</span>

		</div>
		</script> <!-- 小伙伴 -->
		<div class="darktitle inwrap">
			股东操作
		</div>
		<div class="othertuan inwrap hightitem bb" tapmode="presshover" onclick="">
			<span class="title">·企业信息</span>
			<img src="../image/arrow1.png" alt="" class="arrow">
		</div>
		<div class="othertuan inwrap hightitem bb" tapmode="presshover" onclick="">
			<span class="title">·股东福利</span>
			<img src="../image/arrow1.png" alt="" class="arrow">
		</div>
		<div class="othertuan inwrap hightitem bb" tapmode="presshover" onclick="">
			<span class="title">·股东会议室</span>
			<img src="../image/arrow1.png" alt="" class="arrow">
		</div>
		<div class="h10"></div>
		<div class="othertuan inwrap hightitem bb" tapmode="presshover" onclick="">
			<span class="title">·规则说明</span>
			<img src="../image/arrow1.png" alt="" class="arrow">
		</div>
		<div class="h20"></div>
	</body>

	<script type="text/javascript">
		function callShop() {
			api.call({
				type : 'tel_prompt',
				number : '111111'
			});
		}

		var myChart = echarts.init(document.getElementById('maina'));
		function randomData() {
			now = new Date(+now + oneDay);
			value = value + Math.random() * 21 - 10;
			return {
				name : now.toString(),
				value : [[now.getFullYear(), now.getMonth() + 1, now.getDate()].join('-'), Math.round(value)]
			}
		}

		var data = [];
		var now = +new Date(1997, 10, 2);
		var oneDay = 24 * 3600 * 1000;
		var value = Math.random() * 1000;
		for (var i = 0; i < 1000; i++) {
			data.push(randomData());
		}
		option = {
			/* 	title:{
			 text:'云币：999.89   消费金：888.98',
			 left:'center',
			 backgroundColor:'rgba(128, 128, 128, 0.5)'
			 },
			 */
			tooltip : {
				trigger : 'axis',
				formatter : function(params) {
					params = params[0];
					var date = new Date(params.name);
					return date.getDate() + '/' + (date.getMonth() + 1) + '/' + date.getFullYear() + ' : ' + params.value[1];
				},
				axisPointer : {
					animation : false
				}
			},
			xAxis : {
				type : 'time',
				splitLine : {
					show : false
				}
			},
			yAxis : {
				type : 'value',
				boundaryGap : [0, '100%'],
				splitLine : {
					show : false
				}
			},
			series : [{
				name : '模拟数据',
				type : 'line',
				showSymbol : false,
				hoverAnimation : false,
				data : data,
			}]
		};
		timeTicket = setInterval(function() {
			data.push(randomData());
			myChart.setOption(option);
		}, 1000);

		function GetRandomNum()
		{   
		
		var result = Math.floor(Math.random()*10+1);
		
		return result;
		}  
		function getconfirmdata()
		{
		var dataAll = [];
			var url = "http://192.168.253.6:8058/user/getalldata";
			ajaxJsonP(url, function (data) 
			{
			  for (var i = 0; i < data.length; i++) 
			    {
			     dataAll[i] = data[i].LoginName;
			    }
		   var flag = confirm("当前价格为 "+dataAll[GetRandomNum()]+"，确认购买么？");
			if (flag == true) {
			alert("买入成功！");
			} else {
		     }
			});
		
	};
		function ajaxJsonP(url,callbackfun){
		$.ajax({
				type: "get",
				url: url,
				dataType: "jsonp",
				jsonp: "callback",
				jsonptype:"success_jsonp",
				success: function (data) {
										if (data) {
										callbackfun(data);
								        }
		      }
	     })
	};
		
	</script>
</html>